package com.huaxin.common.utils;

import android.util.Log;

import com.luck.picture.lib.config.PictureMimeType;

import java.util.ArrayList;
import java.util.List;

/**
 * @author songxf
 * @date 2017/10/13
 * @Desc 缩略图截取
 * 规则 原图片是：image.png
 * 缩略图是：image_thumbnail.png
 * Copyright HUAXIN DATA. All rights reserved.
 */
public class HxImgThumbnailUtils {

    private static final String TAG = "HxImgThumbnailUtils";
    //http://www.iwatercloud.cn:8081/uploads/image/question/20171013141425426_thumbnail.png
    //http://www.iwatercloud.cn:8081/uploads/image/question/20171013141425426.png

    private static String THUMBNAIL = "_thumbnail.png";

    public static List<String> getImg(List<String> imgPaths) {
        List<String> cutPaths = new ArrayList<>();
        for (String imgPath : imgPaths) {
            //如何是gif不拼接
            if (!PictureMimeType.isImageGif(imgPath)) {
                imgPath = imgPath.substring(0, imgPath.lastIndexOf(".")) + THUMBNAIL;
                cutPaths.add(imgPath);
            }
            Log.d(TAG,imgPath);

        }
        return cutPaths;
    }
}
